<div class="row-fluid">
    <div class="span7">
        <div class="widget">
            <div class="wTitle">
                <h5>Add New Manga</h5>
            </div>
            <div class="wContent">
                <div class="formField" id="manga_edit">
                    <input type="hidden" id="manga_id" value="<?= $novel->id ?>" />
                    <input type="hidden" id="manga_slug" value="<?= $novel->slug ?>" />
                    <input type="hidden" id="cover_hidden" value="<?= $novel->cover ?>" />
                    <div class="row-fluid">
                        <!-- Manga name  -->
                        <div class="span3">
                            <span class="fLabel" for="name">Name:</span>
                        </div>
                        <div class="span8">
                            <div class="iconField">
                                <input value="<?= $novel->name ?>" id="name" class="ui-wizard-content" type="text" name="name" placeholder="name">
                                <img alt="" src="<?php echo base_url(); ?>assets/img/icons/14x14/book.png">
                            </div>
                        </div>
                        <div class="span1">
                            <label class="error" for="name" generated="true">(*)</label>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <!-- Other name  -->
                        <div class="span3">
                            <span class="fLabel" for="oname">Other Name:</span>
                        </div>
                        <div class="span8">
                            <div class="iconField">
                                <input value="<?= $novel->oname ?>" id="oname" class="ui-wizard-content" type="text" name="oname" placeholder="name">
                            </div>
                        </div>
                        <div class="span1">
                        </div>
                    </div>
                    <div class="row-fluid">
                        <!-- Author  -->
                        <div class="span3">
                            <span class="fLabel" for="author">Author:</span>
                        </div>
                        <div class="span8">
                            <div class="iconField">
                                <input value="<?= $novel->author ?>" id="author" class="ui-wizard-content" type="text" name="author" placeholder="author">
                                <img alt="" src="<?php echo base_url(); ?>assets/img/icons/14x14/member2.png">
                            </div>
                        </div>
                        <div class="span1">
                        </div>
                    </div>
                    <div class="row-fluid">
                        <!-- Translator  -->
                        <div class="span3">
                            <span class="fLabel" for="translator">Translator:</span>
                        </div>
                        <div class="span8">
                            <div class="iconField">
                                <input value="<?= $novel->translator ?>" id="translator" class="ui-wizard-content" type="text" name="translator" placeholder="Translator">
                                <img alt="" src="<?php echo base_url(); ?>assets/img/icons/14x14/member2.png">
                            </div>
                        </div>
                        <div class="span1">
                        </div>
                    </div>
                    <div class="row-fluid">
                        <!-- Description  -->
                        <div class="span3">
                            <span class="fLabel" for="desc">Description:</span>
                        </div>
                        <div class="span8">
                            <div class="iconField">
                                <textarea id="desc" rows="6" name="desc" placeholder="Manga description"><?= $novel->description ?></textarea>
                            </div>
                        </div>
                        <div class="span1">
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span3">
                            <span class="fLabel" for="status">Status:</span>
                        </div>
                        <div class="span8">
                            <label class="formButton">
                                <input type="radio" value="1" name="novel_status" <?php echo $novel->status == 1 ? 'checked="checked"' : ''; ?>>
                                <span class="text-success">Updating</span>
                            </label>
                            <label class="formButton">
                                <input type="radio" value="2" name="novel_status" <?php echo $novel->status == 2 ? 'checked="checked"' : ''; ?>>
                                <span class="text-error">Finish</span>
                            </label>
                            <label class="formButton">
                                <input type="radio" value="3" name="novel_status" <?php echo $novel->status == 3 ? 'checked="checked"' : ''; ?>>
                                <span class="text-info">Stop</span>
                            </label>
                        </div>
                    </div>	
                    <div class="row-fluid">
                        <div class="span3">
                            <span class="fLabel" for="status">Category:</span>
                        </div>
                        <div class="span8">
                            <div class="row-fluid">
                                <?php
                                for ($i = 0; $i < count($cats); $i++):
                                    $cat = $cats[$i];
                                    if ($i % 2 == 0) {
                                        echo '<div class="row-fluid">';
                                    }
                                    ?>
                                    <div class="span6">
                                        <label class="formButton">
                                            <input type="checkbox" value="<?= $cat->id ?>" name="cats" name="check" <?php echo in_array($cat->id, $novel->cats) ? 'checked="checked"' : ''; ?>> 
                                            <span><?= $cat->name ?></span>
                                        </label>
                                    </div>
                                    <?php
                                    if ($i % 2 == 1 || $i == count($cats) - 1 ) {
                                        echo '</div>';
                                    }
                                endfor;
                                ?>
                            </div>    
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span12" align="center">
                            <input id="edit_manga_submit" class="button sButton bOlive ui-wizard-content ui-formwizard-button" type="button" value="submit">
                        </div>
                    </div>
                    <div class="row-fluid hide" id="err_msg">
                        <div class="span12" align="center">
                            <div class="alert alert-error noMargin">
                            </div>
                        </div>
                    </div>	
                </div>
            </div>
        </div>
    </div>
    <div class="span5">
        <div class="widget">
            <div class="wTitle">
                <h5>Cover <i class="coverLoading"></i></h5>
            </div>
            <div class="wContent">
                <div class="row-fluid">
                    <div class="span5">
                        <ul class="thumbs span11" align="center">
                            <li class="cover_wpr">
                                <a href="#" class="<?php echo $novel->cover == '' ? 'uploadCover' : '' ?>" id="uploadCover">
                                    <img src="<?php echo STATIC_URL . $novel->cover; ?>" />
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="span7">
                        <div class="formField">
                            <ul>
                                <li>Click on image beside to upload new cover.</li>
                                <li>The cover will be resize to 200x300 dimension.</li>
                                <li>Only PNG, JPG, JPEG are allowed.</li>
                            </ul>
                        </div>
                        <div class="coverErr">
                            <ul class="text-error"></ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="divider"><div><span></span></div></div>
        <div class="row-fluid">
            <div class="span12">
                <div class="widget">
                    <div class="wTitle">
                        <h5>Manage Tools</h5>
                    </div>
                    <div class="wContent">
                        <div class="formField">
                            <div class="row-fluid" align="center">
                                <a class="button sButton bMuddy editRemoveManga" href="#" id="removeManga_<?= $novel->id ?>" rel="<?= $novel->name ?>">Remove forever</a>
                            </div>
                            <div class="row-fluid" align="center">
                            </div>

                        </div>
                    </div>
                </div>
            </div>	
        </div>
    </div>
</div>
<div class="divider"><div><span></span></div></div>
<div class="row-fluid">
    <div class="span2">
        <div class="widget">
            <div class="wTitle">
                <h5>Chapter List</h5>
                <h5 class="pull-right showParseManga" id="showParseManga" >
                    <a href="#"><i class="icon-arrow-right"></i></a>
                </h5>
            </div>
            <div class="wContent">
                <div class="formField">
                    <div class="row-fluid">
                        <div class="span7 form-inline ">
                            <input id="inpAddChapter" pattern="\d*" type="text" class="input-small" placeholder="Chapter">
                        </div>
                        <div class="span5">
                            <a id="btnAddChapter" class="label noShadow bSky submitBtn" href="#">Add</a>
                        </div>
                    </div>
                </div>	
                <div class="box-wrap antiscroll-wrap wContentInner" style="width: 110px;">
                    <div class="box">
                        <div class="antiscroll-inner">
                            <div class="box-inner">
                                <input type="hidden" id="chapter_id" value="" />
                                <ul id="chapterList" class="unstyled chapterList">
                                    <?php foreach ($novel->chapter as $chapter) { ?>
                                        <li>
                                            <a href="#" rel="<?= $chapter['chapter'] ?>">
                                                <span class="badge noShadow bSky"><?= $chapter['chapter'] ?></span> 
                                            </a>	
                                        </li>
                                    <?php } ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="span10" id="chapterBlock">
        <div class="widget hide chapterDetail" id="chapterDetail">
            <div class="wTitle">
                <h5>Chapter Detail</h5>
                <h5 class="text-error hide pull-right" id="chapterErr" style="font-weight: normal;"></h5>
            </div>
            <div class="wContent">
                <div id="wChapterTitle" class="row-fluid">
                    <div class="span7" style="padding: 10px 10px 0;">
                        <input id="chapterTitle" class="ui-wizard-content" type="text" placeholder="Chapter Title" name="chapterTitle" value="" />
                    </div>
                    <div class="span5" id="chapterStatus" style="padding: 10px 10px 0;">
                        <label class="formButton">
                            <input type="radio" value="1" name="status" checked="checked">
                            <span class="text-success">Public</span>
                        </label>
                        <label class="formButton">
                            <input type="radio" value="2" name="status">
                            <span class="text-error">Pending</span>
                        </label>
                    </div>
                </div>
                <div id="wEditor" class="row-fluid">
                    <div class="span12" style="padding: 0 10px;">
                        <div id="novelContent" style="height: 400px;"></div>
                    </div>
                </div>
                <div class="row-fluid" id="novelAction">
                    <div class="span12" align="center">
                        <input type="button" value="delete" class="button sButton bMuddy ui-wizard-content ui-formwizard-button" id="deleteChapterCtn">
                        <input type="button" value="submit" class="button sButton bOlive ui-wizard-content ui-formwizard-button" id="saveChaptersubmit">
                    </div>
                </div>
                <div id="editor_err_msg" class="row-fluid hide">
                    <div align="center" class="span12">
                        <div class="alert alert-error noMargin">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>